package org.wlc.demov1Impl.util;

import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;

/**
 * @author 王立朝
 * @date 2022/5/17
 * @description:
 */
public class RedisUtils {


    private ScheduledExecutorService scheduledExecutorService = Executors.newScheduledThreadPool(1);

    private AtomicInteger stock = new AtomicInteger(0);

    public RedisUtils() {
        scheduledExecutorService.scheduleAtFixedRate(()->{
            stock.addAndGet(1);
        },0,10000, TimeUnit.MICROSECONDS);
    }

    public int getStockUsed() {
        return stock.get();
    }


}
